import {tVisualEditorBindingValue} from "../../packages/createVisualEditorUser/createVisualEditorBinding/createVisualEditorBindingValue";

export function predefineBindingValue({ bindingValue }: { bindingValue: tVisualEditorBindingValue }) {
  bindingValue.registry({
    code: '@@product-name',
    name: '绑定商品名称',
    getter: (data) => {
      const product: Record<string, any> | undefined = data.data?.product;
      return { done: !!product, val: product?.name };
    },
  });

  bindingValue.registry({
    code: '@@product-price',
    name: '绑定商品价格',
    getter: (data) => {
      const product: Record<string, any> | undefined = data.data?.product;
      return { done: !!product, val: product?.price };
    },
  });

  bindingValue.registry({
    code: '@@product-image',
    name: '绑定商品图片',
    getter: (data) => {
      const product: Record<string, any> | undefined = data.data?.product;
      return { done: !!product, val: product?.image };
    },
  });
}
